perm filename ALHEAD.NEW[AL,HE]4 blob sn#327504 filedate 1978-01-03 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00005 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.SBTTL  Switches, absolute locations, registers, mark instructions
C00006 00003	Routine calling and defining macros  ROUTINE, CALL
C00009 00004	Macros: TELL, INFO, XX, TT, ⊃UTLOC, ALERR, PUNT
C00012 00005	Separate assembly communication facility COMTAB
C00017 ENDMK
C⊗;
.SBTTL  Switches, absolute locations, registers, mark instructions

;This macro gives the switch SW a default value VAL
	.MACRO STSW SW,VAL
	.IFNDF SW
	SW == VAL   ;if do not have a value already, give it one
	.ENDC
	.ENDM



; PROGRAM DEFINITIONS

;  Refer to UNIBUS.BO[11,DOC] for all absolute location meanings

ERRTRP==4		;time out and error trap
ILGINS==10		;illegal instruction
CLKTRP==104		;clock trap
DACVEC==130		;DAC interrupt vector
ADCVEC==134		;ADC interrupt vector
ARMTRP==200		;Arm error interrupt vector
RUG=130000		;Restart of RUG
DDT=130000		;Restart of DDT
PS=177776		;processor status word
VITTS=170777		;Video Intensity Table Table Select
VIT=171000		;Video Intensity Table (400 words long)
KBIS=177560		;keyboard input status
KBIR=177562		;keyboard input register
KBOS=177564		;keyboard output status
KBOR=177566		;keyboard output register
CLKCNT=172544		;clock counter
CLKSET=172542		;clock set register
CLKS=172540		;clock status

STRT11=500		;starting address of program
IBUF==150		;start of input buffer from 11
OBUF==160		;start of output buffer to 11 
HCOR=157776		;highest useable word in core
OREG=HCOR		;put something here, 11TTY will print it on console
IREG=HCOR-2		;11TTY puts stuff here for console input
OUTSW=HCOR-4		;0 => your console; -1 => VT05

;REGISTER DEFINITIONS

PC=%7			;program counter
SP=%6			;stack pointer

RF==%5			;Display pointer
SG==%5			;string pointer
R5=%5

R4=%4			;Saved across procedure calls
R3=%3			;Saved across procedure calls
R2=%2			;Saved across procedure calls
R1=%1			;temp
R0=%0			;temp
AC5==%5			;Temp Floating point register
AC4==%4			; "      "	"      "
AC3==%3			; "      "	"      "
AC2==%2			; "      "	"      "
AC1==%1			; "      "	"      "
AC0==%0			; "      "	"      "

;MARK DEFINITIONS
MARK0 == 6400		;MARK 0
MARK1 == 6401		;MARK 1
MARK2 == 6402		;ETC.
MARK3 == 6403
MARK4 == 6404
MARK5 == 6405

;Routine calling and defining macros  ROUTINE, CALL
;Coded by RHT 9/74. modified to eliminate use of the MARK instruction by ARG 9/77

;This should be used at the start of routines which reference
;	parameters off the RF stack.  It gives the parameters
;	symbolic names for clarity of coding.
;For example,
;
;	ROUTINE FOO,<A,B>
;
;Goes to
;
;	A==4
;	B==2
;FOO:

	.MACRO ROUTINE ID,ARGS
	    .IFNB ARGS
	    NNNN==0
		.IRP II,<ARGS>		;Raise NNNN to twice the number of args.
		     NNNN==NNNN+2
		.ENDM
		.IRP II,<ARGS>		;Assign each arg NNNN and decrease same.
		    .IFDF II
			 .IF1 
			      .ERROR Multiple definition for II
			 .ENDC
		    .ENDC
		     II == NNNN
		     NNNN == NNNN-2
		.ENDM
	   .ENDC
ID:
	.ENDM

;This is useful in calling rountines which reference parameters off
;	the RF stack.  It sets up the stack properly, but does not
;	save R0 or R1.

	.MACRO CALL ID,ARGS
	   .IFNB ARGS
		nn == 0
		.IRP II,<ARGS>
		MOV II,-(SP)	;Push an argument
		nn == nn + 2	;Keep track of how many words we've pushed
		.ENDM
		MOV RF,-(SP)	;Save RF
		MOV SP,RF	;Set up the display in RF.
	   .ENDC
	JSR PC,ID		;Call the routine
	   .IFNB ARGS
		MOV (SP)+,RF	;Restore RF
		ADD #nn,SP	;Pop args off of stack
	   .ENDC
	.ENDM

;This macro is a temporary method of defining floating point
;constants. LABIL is the constant name and MSB and LSB its two
;16 bit octal parts.

       .MACRO FP  LABIL,MSB,LSB
	.MACRO  LABIL
	 	.WORD	MSB,LSB	
	.ENDM
       .ENDM

;Macros: TELL, INFO, XX, TT, PUTLOC, ALERR, PUNT

	.MACRO TELL VAR
		TELL2 VAR,\VAR
	.ENDM

	.MACRO TELL2 S,V
		.PRINT /S = /
		.PRINT /V
/
	.ENDM

	 .MACRO .INFO STR,NUM
		  .PRINT /STR/
		  .PRINT /NUM
/
	 .ENDM

	.MACRO	XX SYM			;Just gives SYM the next number.
	   .IFDF SYM
		.IF1
		.ERROR You are using SYM in two ways!!!
		.ENDC
	   .ENDC
	    SYM == II
	    II == II+2
	.ENDM

	.MACRO TT INX,VAL		;To store data at an offset from II
	 .=II+INX
	 VAL
	.ENDM

	.MACRO PUTLOC   ADR,VAL
	 II==.
	 .= ADR
	 VAL
	.=II
	.ENDM

	.MACRO ALERR MES	;Bad error.  Type message, call debugger.
	MOV #MES,-(SP)		;Push the message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	.ENDM

	.MACRO PUNT MES		;Real bad error.  Type message, call debugger.
	MOV #MES,-(SP)		;Push the message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	MOV #PNTMES,-(SP)	;Push the "Can't continue" message pointer.
	JSR PC,@LERRTRAP	;No need to save registers.  This is done in ERRTRAP.
	BR .-10			;Loop forever or until he gives up
	.ENDM

SPSWITCH == 0	;0 => code, 1 => data

	.MACRO CODE     ;The following is code, it should go in instruction space
	.IFNZ SPSWITCH
	DATA$ == .
	.OFFSET -200000		;For code virtual 0 → physical 200 000
	. == CODE$
	SPSWITCH == 0
	.ENDC
	.ENDM

	.MACRO DATA     ;The following is data, it should go in data space
	.IFZ SPSWITCH
	CODE$ == .
	.OFFSET -400000		;For data virtual 0 → physical 400 000
	. == DATA$
	SPSWITCH == 1
	.ENDC
	.ENDM
;Separate assembly communication facility COMTAB

COMMENT  ⊗  All locations local to one assembly which need
to be known to the others are listed here. They are all virtual addresses. ⊗

COMTAB = 0		;Communication table
INTRP == 400		;Beginning of the interpeter code
PCODE = 120000		;Pseudo-code start address
ARMCOD = 56000		;Beginning of the arm code (ARMEND = 116400)
KERINI = 1000		;Kernel initialization address (physical address)

;The following is the COMTAB.  It has room for =128 labels.

;_____________________________________________________________
 VERSION == 13		;Change this if you change COMTAB!!! |
;-------------------------------------------------------------

. = COMTAB

ARMVER:	.WORD 0		;What the arm code thinks VERSION is.
PCDVER:	.WORD 0		;What the pcode thinks PCVERSION is.

			;Entry in GRAPHS.PAL[AL,HE]
LGETVAL:.WORD 0		;Routine for searching graph structure
LINVLDT:.WORD 0		;Invalidates graph node

			;Entry in INTERP.PAL[AL,HE]
LGETARG:.WORD 0		;Finds place in environment for level-offset

			;Entry in ALIO.PAL[AL,HE]
LERRTRAP:.WORD 0		;Call this to print an error message.

			;The follow entry points are located in ARM.PAL[AL,HE]
LINTARM:.WORD 0		;Arm initialization
LCENTER:.WORD 0		;Center routine
LWHERE:	.WORD 0		;Where routine
LMOVE:	.WORD 0		;Move routine
LERRPTR:.WORD 0		;All error torques:  indirect table
LTHPTR:	.WORD 0		;All theta:  joint angle indirect table
LDVCPTR:.WORD 0		;Device block ptrs for attached servos
LSETBAS:.WORD 0		;Force wrist set base routine
LWRIST:	.WORD 0		;Force wrist resolving routine
LSETC:	.WORD 0		;Force sensing and compliance system initialization
LFRCSIG:.WORD 0		;Initializes job starting, based upon a force reading
LFRCOFF:.WORD 0		;Takes a queued job off of the force signal list
LCOMPLY:.WORD 0		;Sets up force compliance of a given magnitude and direction
LCMPOFF:.WORD 0		;Turns off force compliance in a specified direction

			;The follow entry points are located in ARITH.PAL[AL,HE]
LSQRTF:	.WORD 0		;Square root routine
LSNCSD: .WORD 0		;Sin&Cos routine (degrees)
LACOS:	.WORD 0		;Acos routine (degrees)

			;The follow entry points are located in ARMSOL.PAL[AL,HE]
LUPDATE:.WORD 0		;Arm solution to go from joint angles to transform

COMMENT ⊗
If you want to define where, say, DRIVE is, you should do this:
	PUTLOC LDRIVE, DRIVE
If you want to call, say, GETVAL, you should do this:
	JSR PC,@LGETVAL
⊗

.IF1			;This will go away
	.IFL INTRP-.
	  .ERROR COMTAB runs into interpreter.
	.ENDC
.ENDC